﻿<%@ Page Title="Nhóm sản phẩm" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master"
    AutoEventWireup="true" CodeBehind="CategoryManagement.aspx.cs" Inherits="PanasonicWarranty.UI.CategoryManagement"  %>

<%@ Register Src="../UserControl/ucPaging.ascx" TagName="ucPaging" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CssContent" runat="server">
    <link href="../css/uploadify.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script src="../js/jquery.uploadify.js" type="text/javascript"></script>
    <script src="../js/pana_authorization.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            RegisterDialog();
            $("[id$='fuImport']").fileUpload({
                'uploader': '../js/uploader.swf',
                'cancelImg': '../img/cancel.png',
                'buttonText': 'Browse Files',
                'script': '../Handler/UpLoad2.ashx',
                'fileDesc': 'Excel file',
                'fileExt': '*.xls;*.xlsx;',
                'multi': false,
                'auto': false,
                'onComplete': function (file, data, response, c) {
                    $("#spUploadResult").html(c);
                }
            });
        });

        function Authorize(role) {
            return Check_Authorize("{'roles': " + JSON.stringify(role) + "}");
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid">
                </div>
                <h1>Điều kiện tìm kiếm</h1>
                <div class="clear"></div>
            </div>
            <div class="block-fluid" style="padding: 10px 0px 5px 10px">
                <table width="100%" cellspacing="0" cellpadding="0" class="">
                    <tbody>
                        <tr>
                            <td>Nhóm sản phẩm</td>
                            <td><asp:TextBox ID="txtSearchCode" runat="server" /></td>
                        </tr>
                        <tr>
                            <td>Hết hạn</td>
                            <td>
                                <asp:DropDownList ID="ddlSearchDisabled" runat="server">
                                    <asp:ListItem Value="">-----</asp:ListItem>
                                    <asp:ListItem Value="false">False</asp:ListItem>
                                    <asp:ListItem Value="true">True</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <div style="text-align: center">
                    <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" OnClick="btnSearch_Click"
                        CssClass="btn" />
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid"></div>
                <h1>Danh mục nhóm sản phẩm</h1>
                <ul class="buttons">
                    <li><asp:LinkButton CssClass="isw-download" ID="btnDownload" runat="server" 
                            ToolTip="Download mẫu file upload" onclick="btnDownload_Click" /></li>
                    <li><asp:LinkButton CssClass="isw-cloud" ID="btnExport" runat="server"
                            ToolTip="Export dữ liệu" OnClick="btnExport_Click" /></li>
                    <li><asp:LinkButton CssClass="isw-attachment" ID="btnUpload" runat="server" 
                            ToolTip="Import danh mục model" OnClientClick="$('#spUploadResult').html(''); return OpenDialog('dialog2',400);" /></li>
                    <li><asp:LinkButton CssClass="isw-plus" ID="lbtnAddNew" runat="server" onclick="lbtnAddNew_Click" /></li>
                </ul>
                <div class="clear">
                </div>
            </div>
            <div class="block-fluid table-sorting">
                <div class="dataTables_wrapper" id="tSortable_wrapper">
                    <div class="dataTables_length">
                        <label>
                            Hiển thị
                            <asp:DropDownList ID="tSortable_length" size="1" aria-controls="tSortable" runat="server"
                                OnSelectedIndexChanged="tSortable_length_SelectedIndexChanged" AutoPostBack="true">
                                <asp:ListItem Value="5">5</asp:ListItem>
                                <asp:ListItem Value="10">10</asp:ListItem>
                                <asp:ListItem Value="25">25</asp:ListItem>
                                <asp:ListItem Value="50" Selected="True">50</asp:ListItem>
                                <asp:ListItem Value="100">100</asp:ListItem>
                            </asp:DropDownList>
                            dòng</label>
                    </div>
                    <div>
                        <uc1:ucPaging ID="pagingtop" runat="server" />
                    </div>
                    <asp:GridView ID="grvData" CssClass="table2 dataTable" runat="server" 
                        AutoGenerateColumns="false" Width="100%"
                        ShowHeaderWhenEmpty="true" onrowcommand="grvData_RowCommand">
                        <Columns>
                            <asp:TemplateField HeaderText="STT" ItemStyle-CssClass="STT">
                                <ItemTemplate>
                                    <%#(Container.DataItemIndex + 1) + (pagingtop.CurrentPage - 1) * pagingtop.PageSize%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="Nhóm sản phẩm" DataField="CateCode" />
                            <asp:BoundField HeaderText="Tên" DataField="CateName" Visible = "false"/>
                            <asp:BoundField HeaderText="Diễn giải" DataField="Description" Visible = "false" />
                            <asp:CheckBoxField HeaderText="Hết hạn" DataField="Disabled" ItemStyle-CssClass="CheckBox"/>
                            <asp:TemplateField HeaderText="Chức năng" ItemStyle-CssClass="Function">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lbtnEdit" Text="Sửa" runat="server"
                                        CommandName="Editing" CommandArgument='<%#Eval("CateCode")%>' />
                                    &nbsp; &nbsp;
                                    <asp:LinkButton ID="lbtnDelete" Text="Xóa" runat="server"
                                        CommandName="Deleting" CommandArgument='<%#Eval("CateCode")%>' OnClientClick="return confirm('Bạn có chắc chắn muốn xóa không?');" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <div class="dataTables_info" id="tSortable_info">
                        <asp:Literal ID="ltrInfo" runat="server" />
                    </div>
                    <div class="dataTables_paginate paging_full_numbers" id="tSortable_paginate">
                        <uc1:ucPaging ID="pagingbottom" runat="server" />
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
    </div>
    <div class="dialog" id="dialog1" title="Thông tin nhóm sản phẩm" style="display: none; width: 600px; height: 600px;">
        <asp:Panel ID="pnlDialogBlock" runat="server" CssClass="block">
            <asp:HiddenField ID="hdfID" Value="" runat="server" />
            <table width="100%" cellpadding="2" cellspacing="2" >
                <tr>
                    <td>Mã nhóm sản phẩm</td>
                    <td><asp:TextBox ID="txtCateCode" runat="server" /></td>
                </tr>
                <tr>
                    <td>Tên nhóm sản phẩm</td>
                    <td><asp:TextBox ID="txtCateName" runat="server" /></td>
                </tr>
                <tr>
                    <td>Ghi chú</td>
                    <td><asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" /></td>
                </tr>
                <tr>
                    <td>Hết hạn</td>
                    <td><asp:CheckBox ID="chkDisable" runat="server" Checked="false"/></td>
                </tr>
            </table>
            <div class="dr"><span></span></div>
            <div style="text-align: right">
                <asp:Button ID="btnSave" CssClass="btn" runat="server" Text="Lưu" 
                    onclick="btnSave_Click" />
                <input type="button" class="btn" value="Đóng" onclick="$('#dialog1').dialog('close'); return false;" />
            </div>
        </asp:Panel>
    </div>
    <div class="dialog" id="dialog2" title="Lựa chọn file Import" style="display: none;">
        <asp:Panel ID="pnl_dialog2" runat="server" CssClass="block">
            <div>
                <asp:FileUpload ID="fuImport" runat="server" />
            </div>
            <div style="text-align:center; color:Red">
                <span id="spUploadResult"></span>
            </div>
            <div class="dr"><span></span></div>
            <div style="text-align: right">
                <input type="button" class="btn" value="Import" onclick='if(Authorize("Upload"))$("[id$=fuImport]").fileUploadStart();' />
                <asp:Button ID="btnCancel" CssClass="btn" Text="Đóng" OnClientClick="$('[id$=fuImport]').fileUploadClearQueue(); $('#dialog2').dialog('close'); return false;" runat="server" />
            </div>
        </asp:Panel>
    </div>
</asp:Content>
